﻿using System;

namespace SharePoint.Contrib.Diagnostics
{
    /// <summary>
    /// Add this attribute to your assembly to specify a DiagnosticsArea and its DiagnosticsCategories
    /// </summary>
    [AttributeUsage(AttributeTargets.Assembly, AllowMultiple=true, Inherited = false)]
    public class DiagnosticsAreaAttribute : Attribute
    {
        internal Area Area { get; private set; }

        /// <summary>
        /// Create a DiagnosticsArea and its DiagnosticsCategories
        /// </summary>
        /// <param name="area">The name of the area</param>
        /// <param name="categories">One or more categories to add to the area</param>
        public DiagnosticsAreaAttribute(string area, params string[] categories)
        {
            Area = AreaFactory.Create(area, categories);
        }
    }
}
